<div>
    <table id="wQbdTecTopicreviewTable" lay-filter="wQbdTecTopicreviewTable"></table>
    <form class="reportList-isShow">
        <input type="text" id="successDataId" name="successDataId">
    </form>
</div>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdTecTopicreviewRightToolsBar">
    <a class="RightBtn" lay-event="particulars">详情</a>
</script>

<script>
    //一般直接写在一个js文件中
    layui.use(['table',  'common', 'publicMethods', 'jquery', 'layer'], function () {
        var table = layui.table;
        var common = layui.common;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;
        common.tableSort('wQbdTecTopicreviewTable');

        var tableH = publicMethods.layerHeight();
        var dataId = "${dataId}";

        //第一个实例
        table.render({
            elem: '#wQbdTecTopicreviewTable'
            , height: tableH
            , url: serverPath.qbdmsPath + '/qbdms/wQbdTecTopicreview/reportList?id=' + dataId + "&tableName=w_qbd_tec_topicreview"
            , method: 'post'
            , autoSort: false //是否排序
            , cols: [
                [ //表头
                    {type: 'checkbox', fixed: 'left'},
                    {field: 'fMeetingname', title: '会议名称',minWidth:100},
                    //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.fMeetingdate,"1");
                    //如需转换为HH:mm:ss: return publicMethods.timeData(d.fMeetingdate,"2");
                    // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.fMeetingdate);
                    {
                        field: 'fMeetingdate', title: '会议时间',minWidth:100,  templet: function (d) {
                            return publicMethods.timeData(d.fMeetingdate);
                        }
                    }
                    , {field: 'fMeetingaddress', title: '会议地点',minWidth:100}
                    , {field: 'fOrganizingman', title: '组织人',minWidth:100}
                    , {field: 'fChdw', title: '参会单位',minWidth:100}
                    , {field: 'fConferencepersonnel', title: '会务人员及联系方式',minWidth:170}
                    , {
                    fixed: 'right',
                    title: '管理',
                    width:80,
                    align:'center',
                    toolbar: '#wQbdTecTopicreviewRightToolsBar'
                }
                ]], done: function () {
            }
        });

        table.on('tool(wQbdTecTopicreviewTable)', function (obj) {
            var data = obj.data, //获得当前行数据
                layEvent = obj.event; //获得 lay-event 对应的值
            switch (layEvent) {
                case "particulars":
                    var height=publicMethods.layHeight('body');
                    layer.open({
                        type: 2,
                        area: ['96%', height],
                        title: ['课题评审会信息'],
                        content: serverPath.qbdmsPath + '/qbdms/wQbdTecTopicreview/view/particulars?id=' + data.id + "&isClose=true"
                    });
                    break;
            }
        });

        table.on('checkbox(wQbdTecTopicreviewTable)', function (obj) {
            if (obj.type == "all") {
                if (obj.checked) {
                    $("input[name='successDataId']").val("");
                    var checkStatus = table.checkStatus('wQbdTecTopicreviewTable');
                    var valArr = checkStatus.data;//选中行数据
                    var ceshiVal = $("input[name='successDataId']").val();
                    for (var i = 0; i < valArr.length; i++) {
                        ceshiVal = ceshiVal + valArr[i].id + ",";
                    }
                    $("input[name='successDataId']").val(ceshiVal);
                } else {
                    $("input[name='successDataId']").val("");
                }
            } else {
                if (obj.checked) {
                    var ceshiVal = $("input[name='successDataId']").val();
                    $("input[name='successDataId']").val(ceshiVal + obj.data.id + ",");
                } else {
                    var ceshiVal = $("input[name='successDataId']").val();
                    var newVal = "";
                    var valArr = ceshiVal.split(obj.data.id + ",");
                    for (var i = 0; i < valArr.length; i++) {
                        newVal += valArr[i];
                    }
                    $("input[name='successDataId']").val(newVal);
                }
            }
        });

    });
</script>
<!--</body>-->
<!--</html>-->